import java.util.Scanner;
public class lq4 {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int a=in.nextInt();
        int t=0;
        int[] b =new int[100000];
        for (int i = 0; i <a ; i++) {
            b[i]=in.nextInt();
        }
        for (int i = 0; i <a; i++) {
            for (int j = 0; j <a-1-i; j++) {
                if(b[j+1]>b[j]){
                    int u=b[j+1];
                    b[j+1]=b[j];
                    b[j]=u;
                }
            }
        }
        for (int i = 0; i <a; i++) {
            t=t+b[i];
        }
        System.out.println(b[0]);
        System.out.println(b[a-1]);
        System.out.println(t);
    }
}
